﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Default3 : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        string strCategory = Page.RouteData.Values["catname"].ToString();
        strCategory = strCategory.Replace("|", "&");
        Page.Title = strCategory;
        CatLiteral.Text = strCategory;

        //SqlDataSource1.SelectCommand = "SELECT * FROM [Game] where Active=1 and Category='" + strCategory + "' order by plays_total desc";
        SqlDataSource1.SelectCommand = "select distinct * from game where id in (select cg.game_id from catgame cg where cg.category_id in(select id from category where category='" + strCategory + "')) order by plays_total desc";
        //cphMain.Controls.Add(new LiteralControl(strCategory));


        string strTitle = strCategory;
        string strDesc = strCategory;
        if (strDesc.Length < 1) strDesc = strTitle;
        strDesc = System.Web.HttpUtility.HtmlDecode(strDesc);
        string strURL = HttpContext.Current.Request.Url.AbsoluteUri;
        string strKey = strCategory;
        if (strKey.Length < 1) strKey = strTitle;
        cphHead.Controls.Add(new LiteralControl("<meta name='description' content='" + strDesc + "' />"));
        cphHead.Controls.Add(new LiteralControl("<meta name='keywords' content='" + strKey + "' />"));
        cphHead.Controls.Add(new LiteralControl("<meta name='og:title' content='" + strTitle + "' />"));
        cphHead.Controls.Add(new LiteralControl("<meta name='og:description' content='" + strDesc + "' />"));
        cphHead.Controls.Add(new LiteralControl("<meta name='og:url' content='" + strURL + "' />"));
        cphHead.Controls.Add(new LiteralControl("<meta name='og:type' content='article' />"));
        cphHead.Controls.Add(new LiteralControl("<meta name='twitter:title' content='" + strTitle + "' />"));
        cphHead.Controls.Add(new LiteralControl("<meta name='twitter:description' content='" + strDesc + "' />"));
        cphHead.Controls.Add(new LiteralControl("<meta name='twitter:url' content='" + strURL + "' />"));
        cphHead.Controls.Add(new LiteralControl("<meta name='twitter:card' content='summary' />"));

    }
}